define(['app'], function(app) {
	'use strict';
	//实例化方法
	var factory = function(Http) {
		/**
		 * 一键切换数据获取方式
		 * @param {Object} result
		 */
		function get_data_getexhibitionlist(result) {
			if(false) {
				result ='{"success": true,"msg": "","result": {"exhibition": [{"id": "001","name": "五金展会","image": "./img/upload/pro-img01.jpg","time": "2017/01/01 09:00:00"},{"id": "002","name": "上海大全展会","image": "./img/upload/pro-img01.jpg","time": "2017/01/01 09:00:00"}]},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		}
		
		//行业分布
		function get_data_distributionlist(result) {
			if(false) {
				result ='{"success":true,"msg":"","result":{"market":[{"id":"001","name":"五金展会","image":"./img/upload/pro-img01.jpg","shop":[{"id":"001","name":"世达","image":"img/bg-kef-img.png","brief":"世达旗舰店","url":"","is_gold":1},{"id":"002","name":"博士","image":"img/bg-kef-img.png","brief":"博士旗舰店","url":"","is_gold":0}]},{"id":"001","name":"五金展会2","image":"./img/upload/pro-img01.jpg","shop":[{"id":"001","name":"世达2","image":"img/bg-kef-img.png","brief":"世达旗舰店2","url":"","is_gold":1},{"id":"002","name":"博士2","image":"img/bg-kef-img.png","brief":"博士旗舰店2","url":"","is_gold":0}]}]},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		}
		
		//返回信息
		return {
			//获得行业展会一览
			getlist: function(key, pagelimit,nPage,callback,calldone) {
				Http.post({
					method: 'info.exhibition.getlist',
					key: key,
					pagelimit:pagelimit,
					nPage:nPage
				}, function(result) {
					//请求成功
					if(callback) {
						callback(get_data_getexhibitionlist(result).result);
					}
				}, function(e) {
					//请求异常
				}, function() {
					//请求完成，一般不做什么事情
					if(calldone)
						calldone();
				});
			},
			//获得行业分布
			distribution: function(region_id,pagelimit,nPage,callback,calldone) {
				Http.post({
					method: 'info.distribution.getlist',
					region_id: region_id,
					pagelimit:pagelimit,
					nPage:nPage
				}, function(result) {
					//请求成功
					if(callback) {
						callback(get_data_distributionlist(result).result);
					}
				}, function(e) {
					//请求异常
				}, function() {
					//请求完成，一般不做什么事情
					if(calldone)
						calldone();
				});
			},
		};
	}
	factory.$inject = ['Http'];
	return app.registerService("Show", factory);
});